/**
 * 
 */
package com.dragon.modules.yuegou.client.wechat.response;

import com.dragon.common.exception.DragonException;
import com.dragon.modules.yuegou.enums.code.LiveCode;
import com.dragon.modules.yuegou.enums.code.LiveUtils;

import java.io.Serializable;

/**
 * @author 创建直播间响应
 *
 */
public class CreateRoomResponse implements Serializable{
	private static final long serialVersionUID = 928841643046097113L;

	//房间ID
	private Long roomId;
	
	//响应值
	private Integer errcode;
	
	//响应内容
	private String errmsg;

	public Long getRoomId() {
		return roomId;
	}

	public void setRoomId(Long roomId) {
		this.roomId = roomId;
	}

	public Integer getErrcode() {
		return errcode;
	}

	public void setErrcode(Integer errcode) {
		this.errcode = errcode;
	}
	
	public String getErrmsg() {
		return errmsg;
	}

	public void setErrmsg(String errmsg) {
		this.errmsg = errmsg;
	}

	// 响应较验
	public void check() {
		if (null != errcode && errcode.intValue() != 0) {
			LiveCode liveCode = LiveUtils.getLiveCode(errcode);
			if (liveCode == null) {
				throw new DragonException(LiveCode.LIVE_ERROR.getCode(),String.format(LiveCode.LIVE_ERROR.getMessage(),errmsg));
			}else {
				throw new DragonException(liveCode);
			}
			
		}
	}
	
}
